package com.kefu.boss.controller;

import cn.hutool.core.lang.tree.Tree;
import com.kefu.boss.model.BossUser;
import com.kefu.boss.service.BossSelfService;
import com.kefu.common.controller.AbstractBaseController;
import com.kefu.common.result.Result;
import com.kefu.common.result.ResultGenerator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "业务支撑个人信息")
@RestController
@RequestMapping("boss/self")
public class BossSelfController extends AbstractBaseController {
    @Resource
    protected BossSelfService bossSelfService;

    @PostMapping("/info")
    @ApiOperation(value = "个人信息", notes = "个人信息")
    public Result<BossUser> info() {
        return ResultGenerator.genSuccessResult(bossSelfService.findSelfInfo());
    }
    
    @PostMapping("/menu")
    @ApiOperation(value = "个人菜单", notes = "个人菜单")
    public Result<List<Tree<String>>> menu() {
        List<Tree<String>> list = bossSelfService.selfMenuList();
        return ResultGenerator.genSuccessResult(list);
    }
}
